package doh.util;
import java.lang.Comparable;
import java.io.Serializable;

public class LadderEntry implements Comparable, Serializable {
    public String player;
    public int rating;
    public LadderEntry(String player, int rating) {
        this.player = player;
        this.rating = rating;
    }

    @Override
    public int compareTo(Object anotherLadderEntry) {
    if (!(anotherLadderEntry instanceof LadderEntry))
      throw new ClassCastException("A LadderEntry object is expected.");
    return ((LadderEntry)anotherLadderEntry).rating - this.rating;
    }

    @Override
    public String toString() {
        return rating+"\t"+player;
    }
}
